﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;

namespace FA_Server
{
   public class FA_S_Department
    {

       public DataTable DDT;
       private DAC DAC = new DAC();

       public FA_S_Department(string scorpcode)
       {
           DbConnection conn = DAC.CreateConnection();
           if (conn.State != ConnectionState.Open)
               conn.Open();
           DbCommand comd = conn.CreateCommand();
           comd.CommandText = " SELECT to_char(ROWNUM),C.SCORPNAME,SDEPARTMENTCODE ,SDEPARTMENTNAME   FROM DEPARTMENT D, FA_CORP C  WHERE D.SCORPCODE = C.SCORPCODE AND D.SCORPCODE=:sCorpCode";
           DAC.AddInParameter(comd, "sCorpCode", DbType.String, "JW00000001");
           DDT=DAC.ExecuteDataTable(comd);
           DDT.Columns["TO_CHAR(ROWNUM)"].ColumnName = "ROWNUM";
           DAC.ClearParameterCache();
       }
       public FA_S_Department()
       {
           DbConnection conn = DAC.CreateConnection();
           if (conn.State != ConnectionState.Open)
               conn.Open();
           DbCommand comd = conn.CreateCommand();
           comd.CommandText = " SELECT to_char(ROWNUM),C.SCORPNAME,D.SCORPCODE,SDEPARTMENTCODE ,SDEPARTMENTNAME,SALLPARENTCODE   FROM DEPARTMENT D, FA_CORP C  WHERE D.SCORPCODE = C.SCORPCODE ";
           DDT = DAC.ExecuteDataTable(comd);
           DDT.Columns["TO_CHAR(ROWNUM)"].ColumnName = "ROWNUM";
           DAC.ClearParameterCache();
       }


    }
}
